#!/bin/bash

while read PAR VAL ; do
    PAR=${PAR//[()]/_} # Remove "(" ")" from parameter
    eval ${PAR%:}=${VAL% kB}
done < /proc/meminfo

Apps=$((MemTotal-MemFree-Buffers-Cached-Slab-PageTables-SwapCached))
Swap=$((SwapTotal-SwapFree))

echo $MemFree $Buffers $Cached $Slab $SwapCached $Swap $Apps
